#include "file_manager.h"
File_manager::File_manager()
{
}

bool File_manager::Cd(QString path)
{
    if(cd(path))
    {
        listing();
    }
    return true;
}

void File_manager::listing()
{
    QFileInfoList list = entryInfoList();
    for (int i = 0; i < list.size(); ++i)
    {
        QFileInfo fileInfo = list.at(i);

        if(fileInfo.isDir()){
            list_fileType.append(QString("1"));
        }
        if(fileInfo.isFile()){
            list_fileType.append(QString("2"));

        }

        list_fileSize.append(QString("%1").arg(fileInfo.size()/1024/1024));
        list_last.append(fileInfo.fileName());
        list_fileName.append(fileInfo.fileName());
//        list_last.append(fileInfo.lastModified()toString("dd.MM.yyyy hh:mm:ss")););

        qDebug() << QString("%1 %2").arg(fileInfo.size(), 10).arg(fileInfo.fileName());
    }
    qDebug() << "Signal emit";
    emit listingFini();
//    shareVar();
}
